<extend name="Public:base" />
<block name="title">转诊详情</block>
<block name="content">
    <div class="page__bd">
        <div class="weui-form-preview__bd center_list_one xian_bottom xinxi_con">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">患者姓名：</label>
                <span class="weui-form-preview__value">{$info['pname']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">疾病类型：</label>
                <span class="weui-form-preview__value">{$info['cate']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">目标医院：</label>
                <span class="weui-form-preview__value">{$info['hospital_now']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">时间：</label>
                <span class="weui-form-preview__value">{$info['addtime']}</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">备注：</label>
                <span class="weui-form-preview__value">{$info['remarks']}</span>
            </div>
            <!--<div class="weui-form-preview__item">
                <label class="weui-form-preview__label">状态：</label>
                <span class="weui-form-preview__value">
                    <if condition="$uid eq $info['hospital_pre']">{$info['state1']}<else/>{$info['state2']}</if>
                </span>
            </div>-->
            <div id="" class="chuo chuo_yizhuanzhen">
                <if condition="$uid eq $info['hospital_pre']">
                    {$info['state1']}
                    <else/>
                    {$info['state2']}
                </if>
            </div>
        </div>
        <div class="page__bd">
            <div class="weui-gallery" id="gallery">
                <span class="weui-gallery__img" id="galleryImg"></span>
                <div class="weui-gallery__opr">
                    <a href="javascript:" class="weui-gallery__del">
                        <i class="weui-icon-delete weui-icon_gallery-delete"></i>
                    </a>
                </div>
            </div>
            <div class="weui-cells weui-cells_form">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <div class="weui-uploader">
                            <div class="weui-uploader__hd">
                                <p class="weui-uploader__title txt_cen ">病例信息</p>
                            </div>
                            <div class="weui-uploader__bd">
                                <if condition="is_array($pic)">
                                    <foreach name="pic" item="list">
                                        <li class="weui-uploader__file" style="background-image:url(__ROOT__{$list})">
                                            <img src="__ROOT__{$list}" height="100px" width="100px">
                                        </li>
                                    </foreach>
                                <else/>
                                    <li class="weui-uploader__file" style="background-image:url(__ROOT__{$pic})">
                                        <img src="__ROOT__{$pic}" height="100px" width="100px">
                                    </li>
                                </if>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="weui-panel__bd ">
            <div class="weui-cell beizhu_kuang">
                <div class="weui-cell__hd"><label class="weui-label xinxi_label">病例备注：</label></div>
                <div class="weui-cell__bd ">
                    <p class="beiz">
                        {$info['patient_remarks']}
                    </p>
                </div>
            </div>
        </div>
        <if condition="$uid neq $info['hospital_pre']">
            <if condition="$info['state'] eq 1">
                <div class="weui-cell beizhu_kuang">
                    <div class="weui-cell__hd"><label class="weui-label xinxi_label">转诊反馈：</label></div>
                    <div class="weui-cell__bd ">
                        <textarea class="weui-textarea" placeholder="请输入文本" rows="3" name="feedback" id="feedback"></textarea>
                    </div>
                </div>

                <div class="button-sp-area xiugai_but_area">
                    <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_default" id="no">拒绝</a>
                    <a href="javascript:;"  class="weui-btn weui-btn_mini weui-btn_primary" id="mod">接受</a>
                </div>
                <input type="hidden" id="id" name="id" value="{$info['id']}">
                <else/>
                <div class="weui-cell beizhu_kuang">
                    <div class="weui-cell__hd"><label class="weui-label xinxi_label">转诊反馈：</label></div>
                    <div class="weui-cell__bd ">
                        <p class="beiz">
                            {$info['feedback']}
                        </p>
                    </div>
                </div>
            </if>
        </if>
    </div>
    <script type="text/javascript">
        $(function(){
            $("#mod").on('click',function(){
                var id = $('#id').val();
                var feedback = $('textarea[name=feedback]').val();
                $.ajax({
                    type:'post',
                    url:'__MODULE__/User/state',
                    data:{id:id,feedback:feedback,state:3},
                    cache:false,
                    dataType:'json',
                    success:function(res){
                        if(res.code == 0){
                            layer.msg(res.msg,{time:2000},function () {
                                window.location.href = res.url;
                            });
                            return false;
                        }else{
                            layer.msg(res.msg);
                            return false;
                        }
                    }
                });
            });
            $("#no").on('click',function(){
                var id = $('#id').val();
                var feedback = $('textarea[name=feedback]').val();
                $.ajax({
                    type:'post',
                    url:'__MODULE__/User/state',
                    data:{id:id,feedback:feedback,state:2},
                    cache:false,
                    dataType:'json',
                    success:function(res){
                        if(res.code == 0){
                            layer.msg(res.msg,{time:2000},function () {
                                window.location.href = res.url;
                            });
                            return false;
                        }else{
                            layer.msg(res.msg);
                            return false;
                        }
                    }
                });
            });
        });
        </script>
</block>